{if !$smarty.get.add_more}
	{if $smarty.get.all_images}
		{ext->get_binary_list_by_page id=0 page=$smarty.get.page items_per_page=12 assign="image_list"}
	{else}
		{ext->get_binary_list_by_page id=$smarty.get.parent page=$smarty.get.page items_per_page=12 assign="image_list"}
	{/if}
	{assign var="image_list_count" value=$image_list.count}
	{assign var="image_list" value=$image_list.list}
	{ext->paging items_per_page=12 page=$smarty.get.page elements=$image_list_count assign="page_data"}
	{ext->countArray array=$image_list assign="counter"}
{/if}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
{include file="admin/head.html"}
<body onLoad="window.focus();" style="margin: 0; padding: 0; background: #EDF0F2;">
{if $smarty.get.mode != "infield"}
<script language="javascript" type="text/javascript" src="_tvs_system_core_/mce_3.5.8/tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="_tvs_system_core_/mce_3.5.8/plugins/advimage/js/functions.js"></script>
{/if}
<div style="background: #EDF0F2;">
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="background: #FFFFFF;">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td height="35" valign="bottom">
		<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#DBE1E5">
			<tr>
				{if $smarty.get.parent}
				<td {if !$smarty.get.all_images && !$smarty.get.add_more}bgcolor="#25404E"{/if} height="25" width="1"  style="padding:0px 10px 0px 10px "><nobr><a href="index.php?admin=1&inspic=1{if $smarty.get.mode == "infield"}&mode=infield{/if}&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}"  title="{$smarty.get.tpl_parent_name|stripslashes|escape:"html"}" target="_self" class="{if !$smarty.get.all_images && !$smarty.get.add_more}white{else}black{/if}NoUnderline" >{$smarty.get.tpl_parent_name|stripslashes|truncate:"30":"...":true} - {t t="paveikslėlių galerija"}</a></td>	
				<td width="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				{/if}
				<td height="25" width="1" style="padding:0px 10px 0px 10px " {if $smarty.get.all_images}bgcolor="#25404E"{/if}><nobr><a href="index.php?admin=1&inspic=1{if $smarty.get.mode == "infield"}&mode=infield{/if}&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1" target="_self" class="{if $smarty.get.all_images}white{else}black{/if}NoUnderline">{t t="Visų svetainėje esančių paveikslėlių galerija"}</a></td>	
				<td width="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				<td height="25" width="1" style="padding:0px 10px 0px 10px " {if $smarty.get.add_more}bgcolor="#25404E"{/if}><nobr><a href="index.php?admin=1&inspic=1{if $smarty.get.mode == "infield"}&mode=infield{/if}&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&add_more=1" target="_self" class="{if $smarty.get.add_more}white{else}black{/if}NoUnderline">{t t='Įkrauti daugiau paveikslėlių'}</a></td>	
				<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
		</table>
		</td>		
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="5" bgcolor="#25404E"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="1" bgcolor="#FFFFFF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="10"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
{if !$smarty.get.add_more}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td height="360" bgcolor="#FFFFFF" valign="top">
		
		<!-- *  -->
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td height="350" valign="top">
				{foreach from=$image_list item="el"}
					<div style="float: left; width:120px; border:1px solid #e5e5e5; margin:5px; padding:5px">
					<table width="120" cellpadding="0" cellspacing="0">
						<tr>
							<td height="60" align="center"><img src="get.php?i.{$el.id}:w.120:h.60"></td>		
						</tr>
						<tr>
							<td align="center" height="15" valign="bottom">{$el.name|truncate:15:"..."}</td>
						</tr>							
						<tr>
							<td height="19" valign="bottom">		
							{if $smarty.get.mode == "infield"}
							<table cellpadding="0" cellspacing="0" align="center">
								<tr>
									<td><a href="#" target="_self" onClick="top.opener.window.document.forms['form{$smarty.get.parent}'].x_{$smarty.get.field}.value = '{$el.id}';  top.opener.window.InsertFromGallery(1, '{$smarty.get.field}'); window.close();"><img src="_tvs_system_core_/design/img/gallery/01_insert.gif" alt="{t t='Įterpti paveikslėlį į tekstą'}"></a></td>		
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td><a href="#" target="_self" onClick="if (confirm('{t t='Ar tikrai norite ištrinti šį failą?'}')) location.href='index.php?inspic=1&admin=1&mod=text_galery&act=del&id={$el.id}&parent={$smarty.get.parent}&referer={ext->get_referer}'"><img src="_tvs_system_core_/design/img/gallery/05_delete.gif" alt="{t t='Visam laikui ištrinti paveikslėlį iš svetainės'}"></a></td>			
								</tr>
							</table>
							{else}
							<table cellpadding="0" cellspacing="0" align="center">
								<tr>
									<td><a href="#" target="_self" onClick="tinyMCEPopup.execCommand('mceInsertContent', false, '<img src=\'{ext->get_path}/get.php?i.{$el.id}:w.{$el.info.width}:h.{$el.info.height}\' alt=\'\'>'); window.close();"><img src="_tvs_system_core_/design/img/gallery/01_insert.gif" alt="{t t='Įterpti paveikslėlį į tekstą'}"></a></td>		
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="1" bgcolor="#E5E5E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td><a href="#" target="_self" onClick="tinyMCEPopup.execCommand('mceInsertContent', false, '<img class=\'tvs_core_img_style_left\' align=\'left\' src=\'{ext->get_path}/get.php?i.{$el.id}:w.{$el.info.width}:h.{$el.info.height}\' alt=\'\'>'); window.close();"><img src="_tvs_system_core_/design/img/gallery/02_insert_left.gif" alt="{t t='Įterpti paveikslėlį į tekstą lygiuojant prie kairiojo krašto'}"></a></td>		
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="1" bgcolor="#E5E5E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td><a href="#" target="_self" onClick="tinyMCEPopup.execCommand('mceInsertContent', false, '<img class=\'tvs_core_img_style_right\' align=\'right\' src=\'{ext->get_path}/get.php?i.{$el.id}:w.{$el.info.width}:h.{$el.info.height}\' alt=\'\'>'); window.close();"><img src="_tvs_system_core_/design/img/gallery/03_insert_right.gif" alt="{t t='Įterpti paveikslėlį į tekstą lygiuojant prie dešiniojo krašto'}"></a></td>		
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="1" bgcolor="#E5E5E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td><a href="#" onclick="insertAction('<a onclick=\'return openImagePopupID({$el.id},{$el.info.width},{$el.info.height});\' href=\'javascript:void(0);\' >'); window.close();"><img src="_tvs_system_core_/design/img/gallery/04_insert_popup.gif" alt="{t t='Įterpti paveikslėlį į tekstą kaip nuorodą į iššokantį langą'}"></a></td>	
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="1" bgcolor="#E5E5E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td width="5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
									<td><a href="#" target="_self" onClick="if (confirm('{t t='Ar tikrai norite ištrinti šį failą?'}')) location.href='index.php?inspic=1&admin=1&mod=text_galery&act=del&id={$el.id}&parent={$smarty.get.parent}&referer={ext->get_referer}'"><img src="_tvs_system_core_/design/img/gallery/05_delete.gif" alt="{t t='Visam laikui ištrinti paveikslėlį iš svetainės'}"></a></td>			
								</tr>
							</table>
							{/if}
							</td>
						</tr>
					</table>
					</div>
				{/foreach}
				<div style="clear: both;"></div>
				{if $counter==0}
				<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td height="340" align="center">
						{t t='Šis punktas neturi paveikslėlių. Įkraukite juos arba išsirinkite vieną iš visų svetainėje esančių paveikslėlių.'}
						<br>
						<a href="index.php?admin=1&inspic=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1" target="_self" class="{if $smarty.get.all_images}white{else}black{/if}NoUnderline"><strong>{t t='Visi svetainėje esantys paveikslėliai'}</strong></a>
						</td>		
					</tr>
				</table>
				{/if}
				
				</td>		
			</tr>
		</table>
		
		<!-- /*  -->
		
		<!-- * paging  -->
		{if $page_data.totalelements!=0}
		<form name="puslapiukai" method="get" enctype="multipart/form-data" style="margin:0; padding:0;">
			<input type="hidden" name="admin" value="1">
			<input type="hidden" name="inspic" value="1">
			<input type="hidden" name="parent" value="{$smarty.get.parent}">
			<input type="hidden" name="tpl_parent_name" value="{$smarty.get.tpl_parent_name}">
			<input type="hidden" name="field" value="{$smarty.get.field}">
			<input type="hidden" name="all_images" value="{$smarty.get.all_images}">
			{if $smarty.get.mode == "infield"}<input type="hidden" name="mode" value="infield">{/if}
		<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td align="center" height="18"> 
			{t t='Puslapiai'}	
					{assign var="pages_per_page" value=15}								
					({$page_data.current_page.number} {t t='iš'} {$page_data.totalpages}):
					{if $page_data.current_page.number > $pages_per_page}<a href="index.php?admin=1&inspic=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1&page={$page_data.current_page.number-$pages_per_page}{if $smarty.get.mode == "infield"}&mode=infield{/if}">...</a>{/if}
					{if $page_data.previous_page.number}<a href="index.php?admin=1&inspic=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1&page={$page_data.previous_page.number}{if $smarty.get.mode == "infield"}&mode=infield{/if}">&lt;</a>{/if}
					{foreach from=$page_data.pages item="el"}
						{if ((($page_data.current_page.number < $pages_per_page/2) && ($el.number < $pages_per_page)) || ($el.number >= $page_data.current_page.number-$pages_per_page/2) && ($el.number-$page_data.current_page.number < $pages_per_page/2))}
							{if $page_data.current_page.number!=$el.number}
								<a href="index.php?admin=1&inspic=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}{if $smarty.get.all_images}&all_images=1{/if}&page={$el.number}{if $smarty.get.mode == "infield"}&mode=infield{/if}">{$el.number}</a>
							{else}
								<strong style="color:#B70000">{$el.number}</strong>
							{/if}
						{/if}
					{/foreach}
					{if $page_data.next_page.number}<a href="index.php?admin=1&inspic=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}{if $smarty.get.all_images}&all_images=1{/if}&page={$page_data.next_page.number}{if $smarty.get.mode == "infield"}&mode=infield{/if}">&gt;</a>{/if}				
					{if $page_data.totalpages - $page_data.current_page.number > 15}<a href="index.php?admin=1&inspic=1&parent={$smarty.get.parent}&tpl_parent_name={$smarty.get.tpl_parent_name|stripslashes|urlencode}&field={$smarty.get.field}&all_images=1&page={$page_data.current_page.number+$pages_per_page}{if $smarty.get.mode == "infield"}&mode=infield{/if}">...</a>{/if}
					<input type="text" name="page" onkeyup="if(this.value>0 && this.value<={$page_data.totalpages}) true; else this.value='';" class="defaultInputText" style="width:30px "><input type="image" style="display: none;" src="client/img/spacer.gif" width="1" height="1">
				</td>				
			</tr>
		</table>
		</form>
		{/if}
		<!-- /* paging  -->
		</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>


<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="10"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<form action="index.php" method="post" enctype="multipart/form-data">
<input name="admin" type="hidden" value="1">
<input name="inspic" type="hidden" value="1">
<input name="mod" type="hidden" value="text_galery">
<input name="act" type="hidden" value="add">
<input name="parent" type="hidden" value="{$smarty.get.parent}">
<input name="referer" type="hidden" value="{ext->get_referer}">

<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="15">&nbsp;</td>
		<td>		
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td width="1"><nobr>{t t='Paveikslėlio pavadinimas'}:</td>		
				<td width="10">&nbsp;</td>
				<td><input type="text" class="defaultInputText" name="img_name1"></td>
			</tr>
			<tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
			<tr>
				<td><nobr>{t t='Paveikslėlis'}:</td>		
				<td width="10">&nbsp;</td>
				<td><input type="file" class="defaultInputText" name="img_file1"></td>
			</tr>
		</table>
		</td>
		<td width="140" align="right" valign="top">
		<input type="submit" class="defaultFormButton" style="height:40px" value="{t t='Įkrauti į sistemą'}">
		</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
</form>
{else}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			<td bgcolor="#FFFFFF" valign="top">
				<form action="index.php" method="post" name="forma" enctype="multipart/form-data">
				<input name="admin" type="hidden" value="1">
				<input name="inspic" type="hidden" value="1">
				<input name="mod" type="hidden" value="text_galery">
				<input name="act" type="hidden" value="add">
				<input name="parent" type="hidden" value="{$smarty.get.parent}">
				<input name="referer" type="hidden" value="{ext->get_referer}">
				<input type="hidden" name="add_more" value="1">
				
				<br />
        <div style="height: 370px; overflow: auto;">
        <table width="100%" cellpadding="0" cellspacing="0">
					<tr>
            <td rowspan="2" style="width: 1px; padding: 10px;"><span style="font-size: 18px;">01</span></td>
						<td width="1">{t t='Pavadinimas'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="text" class="defaultInputText" name="img_name01" /></td>
					</tr>
					<tr>
						<td><nobr>{t t='Paveikslėlis'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="file" class="defaultInputText" name="img_file01" /></td>
					</tr>
				</table>
				{section name=celes start=2 loop=10 step=1}
				<br />
				<table width="100%" cellpadding="0" cellspacing="0" style="border-top: 1px solid #e5e5e5;">
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
					<tr>
            <td rowspan="2" style="width: 1px; padding: 10px;"><span style="font-size: 18px;">0{$smarty.section.celes.index}</span></td>
						<td width="1">{t t='Pavadinimas'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="text" class="defaultInputText" name="img_name0{$smarty.section.celes.index}" /></td>
					</tr>
					<tr>
						<td><nobr>{t t='Paveikslėlis'}:</td>
						<td width="10">&nbsp;</td>
						<td><input type="file" class="defaultInputText" name="img_file0{$smarty.section.celes.index}" /></td>
					</tr>
				</table>
				{/section}
				</div>
				<br />

			</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		<td width="140" align="right">
		<input type="submit" onclick="document.forms['forma'].submit();" class="defaultFormButton" style="height:40px" value="{t t='Įkrauti į sistemą'}">
		</td>
		<td width="15"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
</form>
{/if}
</div>
</body>
</html>
